package com.credithc.customers.dataservice.mapper.HYD;

import com.credithc.customers.dataservice.po.CustomerNoPo;
import com.credithc.customers.dataservice.po.SystemLendPo;
import com.credithc.customers.dataservice.po.SystemUserPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface HydMapper {
    @Select("select customer_no customerNo , pre_customer_no preCustomerNo ,user_id id FROM jsd_yzt_customer_relation where user_id =#{value}")
    CustomerNoPo getByUserId(String value);

    @Select("select  user_id userId, loan_type productId, stage_num period,credit_amount amount,make_loans_time capitalEffectDate ,repay_time_end  expireDate ,business_sts sts ,id incrementId \n" +
            " from jsd_loan_order where id< #{incrementId} and id >= #{incrementId}-10000  \n" +
            " ORDER BY id desc;")
    List<SystemLendPo> queryHydLend(@Param("incrementId")String incrementId);

    @Select("select MAX(id)  from jsd_loan_order\n ")
    Long queryLendMaxId();
    @Select("select MAX(id)  from jsd_debit_card\n ")
    Long queryBankMaxId();
    @Select("select jsd_yzt_customer_relation.customer_no customerNo ,jsd_debit_card.card_number customerId ,jsd_debit_card.auth_time  creatTime  , jsd_debit_card.user_id userId from jsd_debit_card LEFT JOIN jsd_yzt_customer_relation\n" +
            "on jsd_yzt_customer_relation.user_id = jsd_debit_card.user_id\n" +
            "\n" +
            "where jsd_debit_card.id < #{toString} and jsd_debit_card.id >=#{toString}-10000")
    List<SystemUserPo> queryhydBank(String toString);
}
